Skip to content

Codex/bsdtar gap b partial#2710

Merged
ChanTsune merged 2 commits into
mainfrom
codex/bsdtar-gap-b-partial
Feb 10, 2026
Merged

Codex/bsdtar gap b partial#2710
ChanTsune merged 2 commits into
mainfrom
codex/bsdtar-gap-b-partial

Conversation

@ChanTsune
Copy link
Copy Markdown
Owner

@ChanTsune ChanTsune commented Feb 8, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Paths that resolve to empty are now properly skipped during archive creation.
    • Archive creation now fails with a descriptive error when no input paths are provided.
  • Tests

    • Added test coverage for empty path handling and missing input validation.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

The changes implement validation and skipping logic for empty paths during archive creation. Input validation prevents operations without source paths. Path transformation detects and skips entries that become effectively empty. Debug logging instruments the skip behavior. Tests verify empty path handling in both direct invocation and substitution scenarios.

Changes

Cohort / File(s) Summary
Path validation and skipping
cli/src/command/core.rs, cli/src/command/core/path.rs
Added helper function is_effectively_empty_path to detect empty path components. Modified edit_entry_name and edit_hardlink to return None for effectively empty paths. Added debug logging when entries are skipped due to empty paths. Includes test coverage for empty/curdir path skipping.
Input validation
cli/src/command/stdio.rs
Added validation guard in run_create_archive to error out early when no input paths are provided (including from @archive sources), preventing downstream processing with zero inputs.
Test infrastructure
cli/tests/cli/stdio.rs
Added module declarations for missing_file and option_substitution test modules.
New test coverage
cli/tests/cli/stdio/missing_file.rs, cli/tests/cli/stdio/option_substitution.rs
Added test verifying archive creation fails without input paths. Added test ensuring entries with empty substituted names are correctly skipped and excluded from archive listing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Cli/refactor/path name editor #2494: Modifies edit_entry_name and edit_hardlink path-editing logic in the same file—directly related to the behavior changes in cli/src/command/core/path.rs.
  • @ support #2523: Updates transform_normal_entry and create_entry entry-transformation flow—the main PR instruments this flow with logging and adds path-skipping behavior changes.

Poem

🐰 Empty paths are now skipped with care,
Debug logs show just what we spare.
Validation checks before we start,
Each component plays its part.
Archives built with paths so true! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Codex/bsdtar gap b partial' is vague and does not clearly describe the actual changes, which involve adding debug logging for skipped entries, detecting empty paths, and validating input paths. Revise the title to clearly describe the main changes, such as 'Add debug logging and validation for empty path handling' or similar language that conveys the purpose of the modifications.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/bsdtar-gap-b-partial

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ChanTsune, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the pna CLI's stdio command by refining its path processing logic and input validation. It introduces checks to prevent the inclusion of effectively empty paths in archives and ensures that archive creation commands fail gracefully when no input files are provided, thereby improving consistency with bsdtar's behavior.

Highlights

  • Path Handling Refinement: Introduced a new utility function is_effectively_empty_path to identify paths that are empty or consist solely of current directory components (e.g., ".").
  • Pathname Editor Behavior: Modified the PathnameEditor to skip entries that result in effectively empty paths after transformations or stripping, aligning its behavior with bsdtar.
  • Archive Creation Validation: Added a validation check to the stdio create command, ensuring it fails gracefully if no input files are specified, preventing the creation of empty archives.
  • New CLI Tests: Included new CLI tests to cover the bsdtar-like behaviors for handling empty paths resulting from substitutions and for failing when creating an archive with no input files.
Changelog
  • cli/src/command/core/path.rs
    • Imported Component from std::path for path analysis.
    • Added is_effectively_empty_path helper function to check for empty or current directory paths.
    • Integrated is_effectively_empty_path checks into PathnameEditor::edit_entry_name and PathnameEditor::edit_hardlink to skip effectively empty paths.
    • Added a new test case editor_skips_empty_or_curdir_paths to verify the new path skipping behavior.
  • cli/src/command/stdio.rs
    • Added a check in run_create_archive to bail! if the files list is empty, enforcing that create mode requires at least one input path.
  • cli/tests/cli/stdio.rs
    • Added missing_file module to the stdio test suite.
    • Added option_substitution module to the stdio test suite.
  • cli/tests/cli/stdio/missing_file.rs
    • New file: Added stdio_create_without_inputs_fails test to confirm stdio create fails without input paths.
  • cli/tests/cli/stdio/option_substitution.rs
    • New file: Added stdio_substitution_empty_name_is_skipped test to verify that entries resulting in empty pathnames after substitution are skipped.
Activity
  • No specific activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request improves compatibility with bsdtar by adding checks to skip archive entries that result in an empty or current-directory-only path after transformations or component stripping. It also introduces a failure condition for create mode when no input files are specified. These changes are accompanied by new integration tests that verify the new behaviors. The implementation is solid. I've added a couple of suggestions to improve the readability of a new helper function and to enhance test coverage for path handling.

Comment thread cli/src/command/core/path.rs Outdated
Comment thread cli/src/command/core/path.rs
@github-actions github-actions Bot added the cli This issue is about cli application label Feb 8, 2026
Add empty-path detection to PathnameEditor so that entries whose
pathname becomes empty (or `.`-only) after substitution or stripping
are skipped, matching bsdtar behavior.

- Add `is_effectively_empty_path` guard to `edit_entry_name` and
  `edit_hardlink` (checked after transform and after strip)
- Log skipped entries at debug level for diagnostics
- Document why `edit_symlink` intentionally lacks the same guard
Previously `pna experimental stdio -c -f out.pna` with no positional
arguments silently created an empty archive. Bail with an actionable
error message, matching bsdtar behavior.
@ChanTsune ChanTsune force-pushed the codex/bsdtar-gap-b-partial branch from 0240034 to 26b84f2 Compare February 8, 2026 11:44
@github-actions github-actions Bot added break API braking change and removed break API braking change labels Feb 8, 2026
@ChanTsune ChanTsune merged commit 6453bc3 into main Feb 10, 2026
139 of 142 checks passed
@ChanTsune ChanTsune deleted the codex/bsdtar-gap-b-partial branch February 10, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli This issue is about cli application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant